package com.vastcom.sigma.admin.dao;


import com.vastcom.sigma.admin.model.Coffeeincoming;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface CoffeeincomingDao extends JpaRepository<Coffeeincoming,String> {

    /*@Query("select c from Cargocate c where c.pid=:cargocateid order by c.basecode")
    List<Cargocate> getCargocatesByCargocateid(@Param("cargocateid") String cargocateid);*/

    @Query("select sum(c.rksl) as rksl,max(c.pm) as pm from Coffeeincoming c group by c.pm")
    Object[] countCoffeeincomingByPm();

    @Query("select c from Coffeeincoming c where c.pm=:pm order by c.jhrq desc ")
    List<Coffeeincoming> getCoffeeincomingsByPmOrderByJhrq(@Param("pm")String pm);

}
